﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using API.Models;

namespace API.Controllers
{
    public class AccountController : ApiController
    {
        private List<User> users = new List<User>();

        public AccountController()
        {

        }

        [HttpPost]
        public async Task<List<User>> GetList(User user)
        {
            var users = await Task.Run(() => dd());

            return users;
        }

        public List<User> dd()
        {
            users.Add(new User()
            {
                UserName = "张三",
                Mobile = "18501685825",
                Password = "123456",
                Age = 34,
                AddTime = DateTime.Now
            });
            users.Add(new User()
            {
                UserName = "李四",
                Mobile = "18501685826",
                Password = "123456",
                Age = 31,
                AddTime = DateTime.Now
            });
            users.Add(new User()
            {
                UserName = "王五",
                Mobile = "18501685827",
                Password = "123456",
                Age = 30,
                AddTime = DateTime.Now
            });
            users.Add(new User()
            {
                UserName = "赵六",
                Mobile = "18501685828",
                Password = "123456",
                Age = 29,
                AddTime = DateTime.Now
            });
            users.Add(new User()
            {
                UserName = "田七",
                Mobile = "18501685829",
                Password = "123456",
                Age = 28,
                AddTime = DateTime.Now
            });

            return users;
        }
    }
}
